package org.pt.controller;

import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.cli.Digest;
import org.apache.commons.codec.digest.DigestUtils;
import org.pt.utils.EnvCheck;
import org.pt.components.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/")
public class TestController {

    @Autowired
    private EnvCheck envCheck;

    @GetMapping("")
    public Response<String> test() {
        String profile=envCheck.getActiveProfile();
        String pwd=envCheck.getPassword();
        String rootpwd= DigestUtils.md5Hex("123456");
        return Response.success(profile+" "+pwd+" "+rootpwd);
    }

    /**
     * 获取当前运行中版本
     */
    @GetMapping(value = "version")
    public Response<String> getVersion() {
        return Response.success("2025/6/12 19:44");
    }
}
